package com.huang.A02_constructor;

/**
 * 目标
 * 掌握构造器以及封装
 */
public class Demo1 {
    public static void main(String[] args) {
        //如果没有写构造器，java会为类自动生成一个无参构造器的
        Student student = new Student();
        /*student.name = "荒天帝";
        student.age = 18;*/

        Student s1 = new Student("张三", 20);
        /*System.out.println(s1.name);
        System.out.println(s1.age);*/

        Student s2 = new Student();
        s2.setAge(-23);
        System.out.println(s2.getAge());
    }
}